<?xml version="1.0"?>
<component name="org.nuxeo.ecm.multi.tenant.actions.override">

  <require>org.nuxeo.ecm.multi.tenant.actions</require>

  <extension point="actions" target="org.nuxeo.ecm.platform.actions.ActionService">

    <!-- Admin Center -->
    <action id="TenantAdministration" label="label.multi.tenant.isolation" link="/incl/tenant/tenant_administration.xhtml" order="150" type="admin_rest_document_link">
      <category>NUXEO_ADMIN</category>
      <filter-id>only_for_manager</filter-id>
    </action>

    <!-- Hide Manage tab for tenants -->
    <action id="TAB_MANAGE">
      <filter-id>denyForTenantConfig</filter-id>
    </action>

    <action id="TAB_CONTENT_HISTORY">
      <filter-id>denyForTenantConfig</filter-id>
    </action>

    <!-- Tenant Administration tabs -->
    <action icon="/icons/file.gif" id="TAB_TENANT_ADMINISTRATION" label="action.view.manage" order="240" type="rest_document_link">
      <category>VIEW_ACTION_LIST</category>
      <filter-id>manage</filter-id>
      <filter-id>allowForTenantConfig</filter-id>
      <filter id="TAB_TENANT_ADMINISTRATION_has_subtabs">
        <rule grant="false">
          <condition>
            #{webActions.getActionsList('TAB_TENANT_ADMINISTRATION_sub_tab').isEmpty()}
          </condition>
        </rule>
      </filter>
      <properties>
        <property name="ajaxSupport">true</property>
        <property name="link">/incl/tabs/document_manage.xhtml</property>
      </properties>
    </action>

    <action icon="/icons/file.gif" id="TAB_TENANT_CONFIGURATION" label="label.tenant.configuration" link="/incl/tabs/tenant_configuration.xhtml" order="40">
      <category>TAB_TENANT_ADMINISTRATION_sub_tab</category>
      <filter-id>tenantAdministrators</filter-id>
      <filter-id>allowForTenantConfig</filter-id>
      <properties>
        <property name="ajaxSupport">true</property>
      </properties>
    </action>

    <action icon="/icons/file.gif" id="TAB_TENANT_RIGHTS" label="action.view.rights" link="/incl/tabs/document_rights.xhtml" order="50">
      <category>TAB_TENANT_ADMINISTRATION_sub_tab</category>
      <filter-id>rights</filter-id>
      <filter-id>tenantAdministrators</filter-id>
      <filter-id>allowForTenantConfig</filter-id>
      <properties>
        <property name="ajaxSupport">true</property>
      </properties>
    </action>

    <action icon="/icons/file.gif" id="TAB_TENANT_LOCAL_CONFIGURATION" label="action.view.local.configuration" link="/incl/tabs/local_configuration.xhtml" order="70">
      <category>TAB_TENANT_ADMINISTRATION_sub_tab</category>
      <filter-id>has_local_configuration_available</filter-id>
      <filter-id>tenantAdministrators</filter-id>
      <filter-id>allowForTenantConfig</filter-id>
      <properties>
        <property name="ajaxSupport">true</property>
      </properties>
    </action>

    <action icon="/icons/file.gif" id="TAB_TENANT_HISTORY" label="action.view.tenant.history" link="/incl/tabs/tenant_history.xhtml" order="100">
      <category>TAB_TENANT_ADMINISTRATION_sub_tab</category>
      <filter-id>tenantAdministrators</filter-id>
      <filter-id>allowForTenantConfig</filter-id>
      <properties>
        <property name="ajaxSupport">true</property>
      </properties>
    </action>

    <action icon="/icons/file.gif" id="TAB_TENANT_TRASH_CONTENT" label="action.view.trash.content" link="/incl/tabs/document_trash_content.xhtml" order="200">
      <category>TAB_TENANT_ADMINISTRATION_sub_tab</category>
      <filter-id>allowForTenantConfig</filter-id>
      <filter-id>tenantAdministrators</filter-id>
      <filter id="viewTrash">
        <rule grant="true">
          <permission>Manage everything</permission>
          <facet>Folderish</facet>
          <condition>#{deleteActions.trashManagementEnabled}</condition>
        </rule>
      </filter>
      <properties>
        <property name="ajaxSupport">true</property>
      </properties>
    </action>

  </extension>

</component>
